package com.hw.protocol.tool.decode.hw;

import com.hw.protocol.tool.model.entity.hw.Alertor;
import com.hw.protocol.tool.model.entity.hw.AlertorHis;
import lombok.extern.slf4j.Slf4j;

/**
 * @author : lihy
 * @date : 2023/10/24 10:29
 * description: 商业报警器历史数据解码器
 */
@Slf4j
public class AlertorHisDecode extends AlertorDecode implements IHisDecode {

    private AlertorHis his;

    public AlertorHisDecode(Alertor alertor, byte[] data) {
        super(alertor, data);
        this.his = (AlertorHis) alertor;
    }

    @Override
    public boolean buildObject() {
        his.setTime(getTime(dataBuf));
        return super.buildObject();
    }

    /**
     * 历史数据需要crc校验
     */
    @Override
    boolean crc() {
        return true;
    }
}
